use "C:\'your directory'\ProvCM01012018_WGS84.dta"


* Table A.3
reg pdpct2018 pdpct2013 unemp deltaturnout, robust
reg pdpct2018 pdpct2013 unemp growth deltaturnout, robust
reg pdpct2018 pdpct2013 unemp growth ratiofor20182017 deltaturnout, robust


* Table A.5
reg pdpct2018 pdpct2013 deltaunemp deltaturnout, robust
reg pdpct2018 pdpct2013 deltaunemp growth deltaturnout, robust
reg pdpct2018 pdpct2013 deltaunemp growth ratiofor20182017 deltaturnout, robust


* Table A.6
reg pdpct2018 pdpct2013 unemp growth ratiofor20182017 deltaturnout, robust
reg pdpct2018 pdpct2013 unemp growth ratiofor20182013 deltaturnout, robust


*** Interactions (Tab A.7 Fig. A3-A4)
reg pdpct2018 pdpct2013 c.ratiofor20182017##c.unemp growth deltaturnout, robust

margins, dydx(ratiofor20182017) at(unemp =(3(0.25)28)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash))legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
addplot(hist unemp, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
yline(0, lcolor(red)) ytitle("Marginal Effect of INCREASE FOREIGN 2017-18", axis(1)) title("") xtitle(UNEMPLOYMENT (provincial)) title("")

margins, dydx(unemp) at(ratiofor20182017 =(0.95(0.01)1.2)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash))legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
addplot(hist ratiofor20182017 if ratiofor20182017<1.2 & ratiofor20182017>0.95, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) title("") xtitle(INCREASE FOREIGN 2017-18(provincial)) title("")


reg pdpct2018 pdpct2013 c.ratiofor20182013##c.unemp growth deltaturnout, robust

margins, dydx(ratiofor20182013) at(unemp =(3(0.25)28)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash))legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
addplot(hist unemp, percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
yline(0, lcolor(red)) ytitle("Marginal Effect of INCREASE FOREIGN 2013-18", axis(1)) title("") xtitle(UNEMPLOYMENT (provincial)) title("")

margins, dydx(unemp) at(ratiofor20182013 =(0.8(0.01)1.9)) vsquish
marginsplot, recast (line) recastci(rline) ciopts(lpattern(dash))legend(off) scheme(s2mono) graphregion(fcolor(white)) xsca(titlegap(2)) ///
addplot(hist ratiofor20182013 , percent yaxis(2) bin(20) lwidth(vvthin) color(none) lcolor(gs10) yscale(alt axis(2)))  ///
yline(0, lcolor(red)) ytitle("Marginal Effect of UNEMPLOYMENT", axis(1)) title("") xtitle(INCREASE FOREIGN 2013-18(provincial)) title("")






